home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 128 36 / q36.d81 / t.2 x font demo < prev    next >
Text File  |  2022-08-28  |  12KB  |  294 lines

  1.  
  2.  
  3.                            2 x F O N T   D E M O
  4.  
  5.                       Program and Text by Bob Markland
  6.  
  7.  
  8.     One distinct advantage the C-128 has over the C-64 is its 80-column
  9. capability. But there are times when the standard character size just won't
  10. do. Notice the banner at the top of the LOADSTAR-128 Presenter. The large
  11. characters are defined within a special font, and consist of numerous
  12. characters pieced together in a particular order.
  13.  
  14.     This is fine when you have a repeated need for only one word or short
  15. phrase. Of course, you can print other words which contain the same letters
  16. as "LOADSTAR," or redefine the font with another word. But in any case you
  17. don't have an entire large alphabet at your disposal.
  18.  
  19.     Often it is desirable to have large text, using many different
  20. characters on various screens. And the solution lies in the 8563 chip's
  21. ability to display any of 512 characters (2 complete sets) simultaneously.
  22. The C-64, on the other hand, can only display 256 characters at a time.
  23.  
  24.     To allow characters to be displayed at two times their normal size I
  25. designed 2 x FONT, which is a magnification of the standard LS-128 font --
  26. then developed the techniques in the demo program to make full use of it.
  27.  
  28.     When utilizing 2 x FONT, your program should also use CONTROL 80 to
  29. move custom fonts into 8563 character memory. You could write your own M/L
  30. font moving routines, but why re-invent the wheel? Besides, CONTROL80 is a
  31. toolbox and provides many useful routines for the rest of your program.
  32. Fender Tucker never writes an 80-column program without it.
  33.  
  34.     To best understand how the demo uses 2 x FONT, you may find it
  35. beneficial to print a hard copy of this text before you run the demo. The
  36. text that follows describes in detail how each technique is used within a
  37. program.
  38.  
  39.  
  40.  2 x FONT DEMO
  41.  -------------
  42.  
  43. 10-70 - Move BASIC up to $4000. This is necessary to accommodate the custom
  44. fonts. Then take care of some housekeeping.
  45.  
  46.   For the demo two different arrays are used: AB$(63,2) and AB(63,4).
  47. However, you need not use both of them in your own programs. Select the one
  48. that does the job the way you prefer.
  49.  
  50.   There are also some handy variables defined in this area:
  51.  
  52.   AZ = 2048 - Address for 8563 attributes.
  53.  
  54.   PLOT=65520 - Kernal PLOT routine to position the cursor.
  55.  
  56.   RV$(x) - Define Reverse ON and OFF.
  57.  
  58.   UC$ - Switch to uppercase.
  59.  
  60.   LC$ - Switch to lowercase.
  61.  
  62.   Load any custom font and FCOPY it to the uppercase/graphic font (0). Then
  63. load 2 x FONT and FCOPY it to the lowercase font (1).
  64.  
  65.   With this configuration you have the uppercase/graphic font for normal
  66. size text, boxes, tiles, and other graphic shapes. The lowercase font is
  67. used exclusively for double size characters. If you FCOPY the 2 x FONT to
  68. the uppercase font (0) then you can use your custom font as the lowercase
  69. font (1).
  70.  
  71.  
  72. 90-130 - The characters in the 2 x FONT are representative of the first 64
  73. characters available in a standard font. READ DATA into a String array to
  74. define the characters. The top half of each character is defined as
  75. AB$(x,1) and the bottom half is AB$(x,2). Note that the CHR$ value of
  76. characters 32-63 is merely a repeat of characters 0-31, and the same data
  77. is reused.
  78.  
  79.  
  80. 150-130 - If your needs dictate, you can instead define a numeric array
  81. AB(63,4) to hold the values in the DATA statements, then use:
  82. PRINTCHR$(AB(screen code,segment)) at print time. Again, note that the data
  83. is the same as when defining strings and is reused for the second half of
  84. the array.
  85.  
  86.  
  87. 210-300 - This area of the program sets up a screen and is of no particular
  88. significance to the discussion.
  89.  
  90. 330 - This line illustrates one way to set up an array containing the
  91. screen codes for the word "LOADSTAR". You can easily READ DATA into an
  92. array to accomplish the same end.
  93.  
  94. 340-360 - By using UC$ for normal text and LC$ for large characters you can
  95. mix sizes at will anywhere on the screen. There are numerous ways to print
  96. each large character. Experiment if you like, or use the following:
  97.  
  98.   SYSPLOT,0,row,col,48 is a quick and easy way to place the cursor where
  99. you want it. You can use POKE235,row: PRINT:PRINTTAB(col) but I find the
  100. plot routine far more efficient. This is especially true because of the way
  101. BASIC 7.0 handles the SYS command. When you use SYS, the parameters that
  102. follow automatically load the Accumulator, X register, Y register, and
  103. Status register with the proper values.
  104.  
  105.  FENDER'S NOTE: I have always used CHAR to place the cursor on the 80-
  106. column screen. As always, whatever works for you is fine with me, unless
  107. it's so cryptic that an editor can't easily tell at a glance what the
  108. coordinates are.
  109.  
  110.   If you are wondering why the number 48 is placed in the Status register,
  111. here's why: The Kernal Plot routine has two functions -- If the carry bit
  112. in the status register is clear (0), Plot places the cursor at the defined
  113. position on the screen. If the carry bit is set (1), Plot returns the
  114. current cursor location in the X and Y registers. The use of 48 parameter
  115. is purely precautionary. In a 100% BASIC program the carry bit should
  116. always be clear. However if your program makes use of any M/L routines, it
  117. may not. Use your own discretion.
  118.  
  119.   PRINTRV$(ABS(character(R)>31)) is an easy way to automatically select
  120. either reverse OFF or ON. Screen codes 0-31 result in zero (0) and 32-63
  121. result in one (1).
  122.  
  123.   PRINTAB$(R,1) prints the top half of the character.
  124.  
  125.   "down,left,left" positions the cursor.
  126.  
  127.   AB$(R,2) prints the bottom half of the character.
  128.  
  129.   By altering the routine slightly, you can print an entire line consisting
  130. of the top half of the characters, then print the bottom half on the next
  131. line. I don't recommend this method, as there is a quirk in the BASIC PRINT
  132. statement.
  133.  
  134.   When the "A" or "!" characters, which contain quote (CHR$(34)) are
  135. printed, the computer is forced into Quote Mode. If you use "up, up, right,
  136. right" to position the cursor for the next character, garbage is printed to
  137. the screen, and the cursor is not positioned properly. There is a solution
  138. described in the discussion of line 950, or you can use some sort of plot
  139. instead.
  140.  
  141.  
  142. 390 - You may find it easier to use STRINGS to hold text. They may not,
  143. however, contain color or cursor control characters.
  144.  
  145.  
  146. 400 - The following dissects a string and converts each ASCII character to
  147. a screen code in a range of 0-63:
  148.  
  149.   FOR R=1 TO LEN(string)
  150.   CV=ASC(MID$(string,R,1)and63
  151.  
  152.   Use CV in a subsequent PRINT statement followed by NEXT. For
  153. demonstration purposes, note that T2$ is defined with every other character
  154. SHIFTed, yet the string is printed correctly. This is not true of
  155. Commodore/key combinations and strange things result.
  156.  
  157.  
  158. 530-590 - All 64 usable characters are displayed using the AB$ method.
  159. Their values 0-63 correspond to the screen code chart in the Commodore
  160. manual and PRG, which you can use as a reference when defining your text.
  161.  
  162.  
  163. 600-710 - In this routine the AB(63,4) array is used to display the
  164. alphabet a segment at a time. To illustrate this technique, the characters
  165. are printed in an unusual manner. However, it is just as easy to print each
  166. complete character, one after the other.
  167.  
  168.  
  169. 730-870 - With CONTROL80's BLOCK command you can produce numerous effects.
  170. This is where the AZ=2048 variable is useful. Attribute memory in the 8563
  171. chip is located in the range of 2048-4095 ($0800-$0FFF). To affect an
  172. attribute use:
  173.  
  174.   BLOCKAZ+row*80+column,number,value
  175.  
  176.   number - (0-255) indicates how many consecutive locations to fill.
  177.  
  178.   value - (0-255) determines the characteristic of the attribute based on
  179.     the following:
  180.  
  181.       128 - Alternate character set
  182.        64 - Reverse Video
  183.        32 - Underline
  184.        16 - Flash
  185.        15 - White
  186.        14 - Light Grey
  187.        13 - Yellow
  188.        12 - Brown
  189.        11 - Light Purple
  190.        10 - Dark Purple
  191.         9 - Light Red
  192.         8 - Dark Red
  193.         7 - Light Cyan
  194.         6 - Dark Cyan
  195.         5 - Light Green
  196.         4 - Dark Green
  197.         3 - Light Blue
  198.         2 - Dark Blue
  199.         1 - Dark Grey
  200.         0 - Black
  201.  
  202.     Keep in mind that 2 x FONT is in the alternate character set so 128 is
  203. the minimum value for all large char